package com.example.springboot_jdk8.request;

public class RequestPipeline {

    //
    public RequestNode head = null;

    //尾节点,每次插入,删除时要移动更新
    public RequestNode tail = null;

    public void push(IRequestApi requestApi) {
        RequestNode requestNode = wrap(requestApi);
        if (head == null) {
            head = requestNode;
            tail = requestNode;
        }else {
            requestNode.pre = tail;
            tail.next = requestNode;
            tail = requestNode;
        }

    }


    public RequestNode wrap(IRequestApi requestApi) {
        RequestNode requestNode = new RequestNode();
        requestNode.api = requestApi;
        return requestNode;
    }

}
